-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TYP: check_untyped_defs pandas.core.resample #34692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TYP: check_untyped_defs pandas.core.resample #34692
Conversation
@@ -966,7 +966,8 @@ def __init__(self, obj, *args, **kwargs): | |||
for attr in self._attributes: | |||
setattr(self, attr, kwargs.get(attr, getattr(parent, attr))) | |||
|
|||
super().__init__(None) | |||
# error: Too many arguments for "__init__" of "object" | |||
super().__init__(None) # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If reading the error message correctly can probably just delete this line instead of ignoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in a mixin, so mypy thinks super() is object.
in use, if the class using the mixin is say DatetimeIndexResamplerGroupby, super() is Resampler where init has the signature is def __init__(self, obj, groupby=None, axis=0, kind=None, **kwargs):
and has a required parameter obj, hence the None here.
if we delete this line tests will fail.
========================================================================= short test summary info ==========================================================================
FAILED pandas/tests/resample/test_datetime_index.py::test_resample_apply_with_additional_args - AttributeError: 'DatetimeIndexResamplerGroupby' object has no attribute 'b...
FAILED pandas/tests/resample/test_resampler_grouper.py::test_apply - AttributeError: 'DatetimeIndexResamplerGroupby' object has no attribute 'binner'
============================================== 2 failed, 1670 passed, 10 skipped, 1 xfailed, 2 warnings in 548.51s (0:09:08) ===============================================
@@ -1569,13 +1570,13 @@ def _get_time_period_bins(self, ax): | |||
labels = binner = period_range(start=ax[0], end=ax[-1], freq=freq, name=ax.name) | |||
|
|||
end_stamps = (labels + freq).asfreq(freq, "s").to_timestamp() | |||
if ax.tzinfo: | |||
end_stamps = end_stamps.tz_localize(ax.tzinfo) | |||
if ax.tz: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the question? these should be equivalent
@WillAyd anything more to do here? |
Thanks @simonjayhawkins |
pandas\core\resample.py:969: error: Too many arguments for "init" of "object"
pandas\core\resample.py:1572: error: "DatetimeIndex" has no attribute "tzinfo"
pandas\core\resample.py:1573: error: "DatetimeIndex" has no attribute "tzinfo"
pandas\core\resample.py:1585: error: "PeriodIndex" has no attribute "asfreq"; maybe "freq"?
pandas\core\resample.py:1867: error: "PeriodIndex" has no attribute "asfreq"; maybe "freq"?
pandas\core\resample.py:1902: error: "PeriodIndex" has no attribute "asfreq"; maybe "freq"?